/**
 Copyright (C) 2013 Yuyao Liang

 This source code is release under the BSD License.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.

 Created on Oct 29, 2013 4:22:05 PM
 */
package com.googlecode.backtest.rule.action;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.joda.time.LocalDate;

/**
 * @author lianyuy
 * 
 */
@XmlRootElement(name = "BackTestAction")
@XmlType(name = "BackTestActionType")
public class BackTestAction implements IBackTestAction {
	@XmlAttribute
	protected LocalDate date;
	@XmlAttribute
	protected BackTestActionMethod method;
	@XmlAttribute
	protected double weight;

	/**
	 * @param localDate
	 * @param buy
	 * @param d
	 */
	public BackTestAction(LocalDate date, BackTestActionMethod method,
			double weight) {
		super();
		setAction(date, method, weight);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.googlecode.backtest.rule.action.IBackTestAction#setAction(org.joda
	 * .time.LocalDate,
	 * com.googlecode.backtest.rule.action.BackTestActionMethod, double)
	 */
	@Override
	public void setAction(LocalDate date, BackTestActionMethod method,
			double weight) {
		this.date = date;
		this.method = method;
		this.weight = weight;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.rule.action.IBackTestAction#getDate()
	 */
	@Override
	public LocalDate getDate() {
		return this.date;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.rule.action.IBackTestAction#getMethod()
	 */
	@Override
	public BackTestActionMethod getMethod() {
		return this.method;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.googlecode.backtest.rule.action.IBackTestAction#getWeight()
	 */
	@Override
	public double getWeight() {
		return this.weight;
	}

}
